/*
 * $Id: UiRequest.java,v 1.12 2012/04/29 22:00:54 navdeep_mahajan Exp $
 *
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 *
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */

package com.ge.healthcare.autosc.ui.pojo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.regexp.RE;

import com.ge.healthcare.autosc.common.ASCUtil;
import com.ge.healthcare.autosc.common.database.pojo.AbstractRequest;
import com.ge.healthcare.autosc.common.database.pojo.AbstractRequestListUser;
import com.ge.healthcare.autosc.common.database.pojo.CfgRequestDefn;
import com.ge.healthcare.autosc.common.database.pojo.CfgRequestType;

public class UiRequest extends AscUiObject implements TimeSortableI,
		Serializable {

	/**
	 * Eclipse generated
	 */
	private static final long serialVersionUID = -397860886098948588L;

	/** The composite primary key value. */
	private java.lang.Long requestId;

	/** The value of the actRequestList association. */
	private Long requestListId;

	private Long requestDefnId;

	/** The value of the simple systemId property. */
	private java.lang.String systemId;

	private Long addressId;

	/** The value of the simple productLine property. */
	private java.lang.String productLine;

	/** The value of the simple modelType property. */
	private java.lang.String modelType;

	/** The value of the simple modality property. */
	private java.lang.String modality;

	/** The value of the simple usn property */
	private java.lang.String usn;

	private String mln;

	/** The value of the simple ipAddress property. */
	private java.lang.String ipAddress;

	/** The value of the simple pole property. */
	private java.lang.String pole;

	/** The value of the simple isoCode property. */
	private java.lang.String isoCode;

	/** The value of the simple modemAreaCityCode property. */
	private java.lang.String modemAreaCityCode;

	/** The value of the simple modemNum property. */
	private java.lang.String modemNum;

	/** The value of the simple connectType property. */
	private java.lang.String connectType;

	/** The value of the simple portMaster property. */
	private java.lang.String portMaster;

	/** The value of the simple serviceCenter property. */
	private java.lang.String serviceCenter;

	private String requestTypeName;
	private String requestDefnDesc;

	private Long requestTypeId;
	private boolean isGenOne;
	private List<UiTask> tasks;
	
	private String sentFrom;
	private Integer ssoId;

	// AutoSC 1.0 variables
	public static final RE TRANSFER_TYPE_VREQ_CODE = new RE("^\\s*IP.*$");
	public static final String ASC_PASSED_CODE = "P";
	public static final String ASC_CODE_SEP = "/";
	public static final String ASC_CODE_PREFIX = "Passed: ";

	/**
	 * Simple constructor of AbstractRequest instances.
	 */
	public UiRequest() {
	}

	public UiRequest(AbstractRequest request) {
		this.load(request);
	}

	public void load(AbstractRequest request) {
		this.setRequestId(request.getRequestId());
		this.setRequestListId(request.getRequestListId());
		this.setRequestDefnId(request.getRequestDefnId());
		this.setCodeId(request.getCodeId());
		this.setSystemId(request.getSystemId());
		this.setAddressId(request.getAddressId());
		this.setProductLine(request.getProductLine());
		this.setModelType(request.getModelType());
		this.setModality(request.getModality());
		this.setUsn(request.getUsn());
		this.setMln(request.getMln());
		this.setIpAddress(request.getIpAddress());
		this.setPole(request.getPole());
		this.setIsoCode(request.getIsoCode());
		this.setModemAreaCityCode(request.getModemAreaCityCode());
		this.setModemNum(request.getModemNum());
		this.setConnectType(request.getConnectType());
		this.setPortMaster(request.getPortMaster());
		this.setServiceCenter(request.getServiceCenter());
		this.setStartTime(request.getStartTime());
		this.setEndTime(request.getEndTime());
		this.setGenOne(false);
		initTasks();
	}

	public void load(CfgRequestType requestType) {
		if (!ASCUtil.isNullOrEmptyObject(requestType)) {
			this.requestTypeName = requestType.getRequestTypeName();
		}
	}

	public void load(CfgRequestDefn requestDefn) {
		if (!ASCUtil.isNullOrEmptyObject(requestDefn)) {
			this.requestDefnDesc = requestDefn.getRequestDesc();
			this.requestTypeId = requestDefn.getRequestTypeId();
		}
	}

	public void load(AbstractRequestListUser user) {
		if (!ASCUtil.isNullOrEmptyObject(user)) {
			this.sentFrom = user.getEmailAddress();
			this.ssoId = user.getSso();
		}
	}

	public void initTasks() {
		tasks = new ArrayList<UiTask>();
	}

	public void add(UiTask task) {
		tasks.add(task);
	}

	/**
	 * Constructor of AbstractRequest instances given a simple primary key.
	 * 
	 * @param requestId
	 */
	public UiRequest(java.lang.Long requestId) {
		this.setRequestId(requestId);
	}

	/**
	 * Return the simple primary key value that identifies this object.
	 * 
	 * @return java.lang.Long
	 */
	public java.lang.Long getRequestId() {
		return requestId;
	}

	/**
	 * Set the simple primary key value that identifies this object.
	 * 
	 * @param requestId
	 */
	public void setRequestId(java.lang.Long requestId) {
		this.requestId = requestId;
	}

	/**
	 * Return the value of the REQUEST_LIST_ID column.
	 * 
	 * @return ActRequestList
	 */
	public Long getRequestListId() {
		return this.requestListId;
	}

	/**
	 * Set the value of the REQUEST_LIST_ID column.
	 * 
	 * @param actRequestList
	 */
	public void setRequestListId(Long requestListId) {
		this.requestListId = requestListId;
	}

	/**
	 * Return the value of the SYSTEM_ID column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getSystemId() {
		return this.systemId;
	}

	/**
	 * Set the value of the SYSTEM_ID column.
	 * 
	 * @param systemId
	 */
	public void setSystemId(java.lang.String systemId) {
		this.systemId = systemId;
	}

	/**
	 * Return the value of the PRODUCT_LINE column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getProductLine() {
		return this.productLine;
	}

	/**
	 * Set the value of the PRODUCT_LINE column.
	 * 
	 * @param productLine
	 */
	public void setProductLine(java.lang.String productLine) {
		this.productLine = productLine;
	}

	/**
	 * Return the value of the MODEL_TYPE column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getModelType() {
		return this.modelType;
	}

	/**
	 * Set the value of the MODEL_TYPE column.
	 * 
	 * @param modelType
	 */
	public void setModelType(java.lang.String modelType) {
		this.modelType = modelType;
	}

	/**
	 * Return the value of the USN column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getUsn() {
		return this.usn;
	}

	/**
	 * Set the value of the USN column.
	 * 
	 * @param modelType
	 */
	public void setUsn(java.lang.String usn) {
		this.usn = usn;
	}

	/**
	 * Return the value of the MODALITY column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getModality() {
		return this.modality;
	}

	/**
	 * Set the value of the MODALITY column.
	 * 
	 * @param modality
	 */
	public void setModality(java.lang.String modality) {
		this.modality = modality;
	}

	/**
	 * Return the value of the IP_ADDRESS column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getIpAddress() {
		return this.ipAddress;
	}

	/**
	 * Set the value of the IP_ADDRESS column.
	 * 
	 * @param ipAddress
	 */
	public void setIpAddress(java.lang.String ipAddress) {
		this.ipAddress = ipAddress;
	}

	/**
	 * Return the value of the POLE column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getPole() {
		return this.pole;
	}

	/**
	 * Set the value of the POLE column.
	 * 
	 * @param pole
	 */
	public void setPole(java.lang.String pole) {
		this.pole = pole;
	}

	/**
	 * Return the value of the ISO_CODE column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getIsoCode() {
		return this.isoCode;
	}

	/**
	 * Set the value of the ISO_CODE column.
	 * 
	 * @param isoCode
	 */
	public void setIsoCode(java.lang.String isoCode) {
		this.isoCode = isoCode;
	}

	/**
	 * Return the value of the MODEM_AREA_CITY_CODE column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getModemAreaCityCode() {
		return this.modemAreaCityCode;
	}

	/**
	 * Set the value of the MODEM_AREA_CITY_CODE column.
	 * 
	 * @param isoCode
	 */
	public void setModemAreaCityCode(java.lang.String modemAreaCityCode) {
		this.modemAreaCityCode = modemAreaCityCode;
	}

	/**
	 * Return the value of the MODEM_NUM column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getModemNum() {
		return this.modemNum;
	}

	/**
	 * Set the value of the MODEM_NUM column.
	 * 
	 * @param isoCode
	 */
	public void setModemNum(java.lang.String modemNum) {
		this.modemNum = modemNum;
	}

	/**
	 * Return the value of the CONNECT_TYPE column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getConnectType() {
		return this.connectType;
	}

	/**
	 * Set the value of the CONNECT_TYPE column.
	 * 
	 * @param connectType
	 */
	public void setConnectType(java.lang.String connectType) {
		this.connectType = connectType;
	}

	/**
	 * Return the value of the PORT_MASTER column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getPortMaster() {
		return this.portMaster;
	}

	/**
	 * Set the value of the PORT_MASTER column.
	 * 
	 * @param portMaster
	 */
	public void setPortMaster(java.lang.String portMaster) {
		this.portMaster = portMaster;
	}

	/**
	 * Return the value of the SERVICE_CENTER column.
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getServiceCenter() {
		return this.serviceCenter;
	}

	/**
	 * Set the value of the SERVICE_CENTER column.
	 * 
	 * @param serviceCenter
	 */
	public void setServiceCenter(java.lang.String serviceCenter) {
		this.serviceCenter = serviceCenter;
	}

	public Long getRequestDefnId() {
		return requestDefnId;
	}

	public void setRequestDefnId(Long requestDefnId) {
		this.requestDefnId = requestDefnId;
	}

	/**
	 * @return the addressId
	 */
	public Long getAddressId() {
		return addressId;
	}

	/**
	 * @param addressId
	 *            the addressId to set
	 */
	public void setAddressId(Long addressId) {
		this.addressId = addressId;
	}

	/**
	 * @return the mln
	 */
	public String getMln() {
		return mln;
	}

	/**
	 * @param mln
	 *            the mln to set
	 */
	public void setMln(String mln) {
		this.mln = mln;
	}

	/**
	 * @return the requestTypeName
	 */
	public String getRequestTypeName() {
		return requestTypeName;
	}

	/**
	 * @param requestTypeName
	 *            the requestTypeName to set
	 */
	public void setRequestTypeName(String requestTypeName) {
		this.requestTypeName = requestTypeName;
	}

	/**
	 * @return the requestDefnDesc
	 */
	public String getRequestDefnDesc() {
		return requestDefnDesc;
	}

	/**
	 * @param requestDefnDesc
	 *            the requestDefnDesc to set
	 */
	public void setRequestDefnDesc(String requestDefnDesc) {
		this.requestDefnDesc = requestDefnDesc;
	}

	/**
	 * @return the requestTypeId
	 */
	public Long getRequestTypeId() {
		return requestTypeId;
	}

	/**
	 * @param requestTypeId
	 *            the requestTypeId to set
	 */
	public void setRequestTypeId(Long requestTypeId) {
		this.requestTypeId = requestTypeId;
	}

	/**
	 * @return the tasks
	 */
	public List<UiTask> getTasks() {
		return tasks;
	}

	/**
	 * @param tasks
	 *            the tasks to set
	 */
	public void setTasks(List<UiTask> tasks) {
		this.tasks = tasks;
	}

	/**
	 * @return the isGenOne
	 */
	public boolean isGenOne() {
		return isGenOne;
	}

	/**
	 * @param isGenOne
	 *            the isGenOne to set
	 */
	public void setGenOne(boolean isGenOne) {
		this.isGenOne = isGenOne;
	}

	/**
	 * @return the sentFrom
	 */
	public String getSentFrom() {
		return sentFrom;
	}

	/**
	 * @param sentFrom the sentFrom to set
	 */
	public void setSentFrom(String sentFrom) {
		this.sentFrom = sentFrom;
	}

	/**
	 * @return the ssoId
	 */
	public Integer getSsoId() {
		return ssoId;
	}

	/**
	 * @param ssoId the ssoId to set
	 */
	public void setSsoId(Integer ssoId) {
		this.ssoId = ssoId;
	}
}
